<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <script src="https://webapi.amap.com/maps?v=1.4.15&key=52fb647990eb9361188e614e247741ab"></script>
    <link rel="stylesheet" href="https://cache.amap.com/lbs/static/main1119.css?v=20180322"/>
    <script src="https://cache.amap.com/lbs/static/es5.min.js"></script>
    <link rel="stylesheet" href="${ctx}/libjs/plugins/swiper/swiper-3.3.1.min.css">
    <link rel="stylesheet" href="${ctx}/statics/css/newEdition.css">
    <script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
    <script src="${ctx}/libjs/plugins/swiper/swiper-3.3.1.jquery.min.js"></script>
    <script src="${ctx}/libjs/plugins/countUp/jquery.countup.min.js"></script>
    <script src="${ctx}/libjs/plugins/flexible/flexible.js"></script>
    <script src="${ctx}/libjs/plugins/flexible/flexible_css.js"></script>
    <%--<script src="${ctx}/libjs/plugins/countUp/jquery.waypoints.min.js"></script>--%>
    <title>欢迎页</title>
    <style>
        .marker-route {
            position: relative;
            margin: 0 auto;
            /* left: 0.5rem; */
            width: 0.08rem;
            height: 0.08rem;
            background: #2229FB;
            border: 1px solid #fff;
            border-radius: 50%;
            cursor: pointer;
            z-index: 9999999999;
            text-align: center;
            font-size: 1.2rem;
            color: #000;
            box-shadow: 0px 0px 3px 3px rgba(34, 41, 251, 0.5);
        }

        #container {
            margin-top: 20px;
            height: 500px;
            position: relative
        }

        .Level_stationName {
            width: 55%;
        }

        .loadingShade {
            position: absolute;
            left: 0;
            top: 0rem;
            z-index: 100;
            width: 100%;
            height: 1.35rem;
            background-color: rgba(255, 255, 255, 0.8);
            text-align: center;
        }

        .loadingShade img {
            height: 100%;
            /*margin-top: -0.35rem;*/
        }
    </style>
</head>
<body>
<%--<button type="button" class="layui-btn layui-btn-normal">百搭按钮</button>--%>
<div class="gray-bg">
    <div class="wrapper wrapper-content">
        <%--        <div class="row">--%>
        <%--            <div class="col-sm-12 orderInfoTitle">--%>
        <%--                <div><span class="titlePiece"></span><span id="titleChange" class="orderInfoTitleFont">本日订单统计</span></div>--%>
        <%--                <ul class="dataByTime">--%>
        <%--                    <li class="selected disabled" dateType="1" onclick="changeTitle('本日订单统计')">日</li>--%>
        <%--                    <li dateType="2" onclick="changeTitle('本月订单统计')">月</li>--%>
        <%--                    <li dateType="3" onclick="changeTitle('本年订单统计')">年</li>--%>
        <%--                </ul>--%>
        <%--            </div>--%>
        <%--        </div>--%>
        <input type="hidden" id="dataAuth" value="${dataAuth}">
        <div class="orderDataBox">
            <div class="loadingShade">
                <img src="${ctx}/statics/img/loading.gif" alt="">
            </div>
            <div class="orderInfoData">
                <div class="orderInfoIcon orderTotalIcon"></div>
                <div class="orderInfoValue">
                    <div class="orderDataFontNumber" id="orderCount">0</div>
                    <div class="orderDataFontLabel">订单总数(单)</div>
                </div>
            </div>
            <div class="orderInfoData">
                <div class="orderInfoIcon chargingTimeIcon"></div>
                <div class="orderInfoValue">
                    <div class="orderDataFontNumber" id="chargingTimeCount">0</div>
                    <div class="orderDataFontLabel">充电时长(小时)</div>
                </div>
            </div>
            <div class="orderInfoData">
                <div class="orderInfoIcon chargingPowerIcon"></div>
                <div class="orderInfoValue">
                    <div class="orderDataFontNumber" id="chargeCount">0</div>
                    <div class="orderDataFontLabel">充电度数(度)</div>
                </div>
            </div>
            <div class="orderInfoData">
                <div class="orderInfoIcon serviceIcon"></div>
                <div class="orderInfoValue">
                    <div class="orderDataFontNumber " id="serviceMoneyCount">0</div>
                    <div class="orderDataFontLabel">服务费收入(元)</div>
                </div>
            </div>
            <div class="orderInfoData last">
                <div class="orderInfoIcon totalAmountIcon"></div>
                <div class="orderInfoValue">
                    <div class="orderDataFontNumber " id="totalMoney">0</div>
                    <div class="orderDataFontLabel">总收入(元)</div>
                </div>
            </div>
        </div>
        <div class="betweenBox">
            <div class="leftDiv">
                <div class="titleBorder">
                    <span class="titlePiece"></span>
                    <span class="orderInfoTitleFont">电桩状态</span>
                    <c:if test="${isBizTypebutton == 0}">
                        <a class="btn btn-success btn-sm baise" onclick="countGun(0)">自营</a>
                        <a class="btn btn-primary btn-sm baise" onclick="countGun(1)">加盟</a>
                    </c:if>
                </div>
                <ul class="leftDataBox">
                    <li>
                        <div class="gunAmount" id="charging">0</div>
                        <div class="gunStatus">充电中</div>
                        <div class="whiteLine"></div>
                    </li>
                    <li>
                        <div class="gunAmount" id="snatching">0</div>
                        <div class="gunStatus ">插枪</div>
                        <div class="whiteLine"></div>
                    </li>
                    <li>
                        <div class="gunAmount" id="idle">0</div>
                        <div class="gunStatus">空闲</div>
                        <div class="whiteLine"></div>
                    </li>
                    <li>
                        <div class="gunAmount " id="offline">0</div>
                        <div class="gunStatus">离线</div>
                        <div class="whiteLine"></div>
                    </li>
                    <li>
                        <div class="gunAmount" id="pileMalfunction">0</div>
                        <div class="gunStatus">故障</div>
                        <div class="whiteLine"></div>
                    </li>
                </ul>
            </div>
            <div class="rightDiv">
                <div class="titleBorder">
                    <span class="titlePiece"></span>
                    <span class="orderInfoTitleFont">站点总览</span>
                    <c:if test="${isBizTypebutton == 0}">
                        <a class="btn btn-success btn-sm baise" onclick="countStation(0)">自营</a>
                        <a class="btn btn-primary btn-sm baise" onclick="countStation(1)">加盟</a>
                    </c:if>
                </div>
                <ul class="rightDataBox">
                    <li>
                        <div class="stationDataAmount" id="stationCount">0</div>
                        <div class="c stationIcon">站点总计</div>
                    </li>
                    <%--                    <li>--%>
                    <%--&lt;%&ndash;                        <div class="stationDataAmount" id="gunCount">0</div>&ndash;%&gt;--%>
                    <%--&lt;%&ndash;                        <div class="stationDataLabel gunIcon">电枪统计</div>&ndash;%&gt;--%>
                    <%--                    </li>--%>
                    <li class="thirdList">
                        <div class="third_Left">
                            <div class="stationDataAmount countUp" id="pileCount">0</div>
                            <div class="stationDataLabel pileIcon ">电桩统计</div>
                        </div>
                        <div class="third_Right">
                            <div class="stationDataLabel">
                                <div class="gunTypeLabel"><span class="DC" style="flex-shrink: 0"></span><span
                                        class="redFont" style="flex-shrink: 0">快充</span><span
                                        class="redFont" id="directCount"></span></div>
                                <div class="layui-progress  layui-progress1" lay-filter="redPercent">
                                    <div class="layui-progress-bar  layui-bg-red"></div>
                                </div>
                                <div class="gunTypeLabel"><span class="redFont" red id="redPercent"></span><span
                                        class="redFont">%</span></div>

                            </div>
                            <div class="stationDataLabel">
                                <div class="gunTypeLabel"><span class="AC" style="flex-shrink: 0"></span><span
                                        class="greenFont" style="flex-shrink: 0">慢充</span><span
                                        class="greenFont" id="alternatCount"></span></div>
                                <div class="layui-progress layui-progress2" lay-filter="greenPercent">
                                    <div class="layui-progress-bar  "></div>
                                </div>
                                <div class="gunTypeLabel"><span class="greenFont" id="greenPercent"></span><span
                                        class="greenFont">%</span></div>
                            </div>
                            <div class="stationDataLabel">
                                <div class="layui-progress layui-progress3" lay-filter="bluePercent">
                                    <div class="layui-progress-bar  layui-bg-blue"></div>
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <div class="bottomBox">
            <%--            <div class="mapBox">--%>
            <%--                <div class="titleBorder"><span class="titlePiece"></span><span class="orderInfoTitleFont">地图</span>--%>
            <%--                </div>--%>
            <%--                <div id="container">--%>

            <%--                </div>--%>
            <%--            </div>--%>
            <div class="leftDiv1">
                <div class="titleBorder"><span class="titlePiece"></span><span class="orderInfoTitleFont">今日数据概览</span>
                </div>
                <ul class="leftDataBox1">
                    <li>
                        <div class="leftData" id="todayPower">0</div>
                        <div class="leftDataLabel">充电量</div>
                    </li>
                    <li>
                        <div class="leftData" id="todayOrder">0</div>
                        <div class="leftDataLabel">充电次数</div>
                    </li>
                    <li>
                        <div class="leftData" id="todayTime">0</div>
                        <div class="leftDataLabel">充电时长</div>
                    </li>
                    <li>
                        <div class="leftData" id="todayMoney">0</div>
                        <div class="leftDataLabel">总收入</div>
                    </li>

                </ul>
            </div>

            <div class="powerList">
                <div class="titleBorder">
                    <span class="titlePiece"></span>
                    <span class="orderInfoTitleFont">站点充电量昨日排名</span>
                    <a class="btn btn-success btn-sm baise" onclick="countStationOrderRank(0)">日</a>
                    <a class="btn btn-primary btn-sm baise" onclick="countStationOrderRank(1)">月</a>
                    <a class="btn btn-success btn-sm baise" onclick="countStationOrderRank(2)">年</a>
                </div>
                <ul id="rank">

                </ul>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    var options = {
        useEasing: true,
        useGrouping: true,
        separator: ',',
        decimal: '.'
    };
</script>
<script type="text/javascript">

    function changeTitle(data) {
        $('#titleChange').html(data);
    }


    //站点总览数据
    function selectStationAllData() {
        $.ajax({
            cache: false,
            type: "get",
            url: jsctx + "/console/selectStationAllData",
            processData: false,
            contentType: false,
            async: true,
            error: function (request) {
                console.log("Connection error");
            },
            success: function (data) {
                if (data.status == 200) {
                    new CountUp("stationCount", 0, data.data.stationCount, 0, 3, options).start();
                    new CountUp("pileCount", 0, data.data.pileCount, 0, 3, options).start();
                    new CountUp("gunCount", 0, data.data.gunCount, 0, 3, options).start();
                    new CountUp("directCount", 0, data.data.directCount, 0, 3, options).start();
                    new CountUp("alternatCount", 0, data.data.alternatCount, 0, 3, options).start();
                    if (data.data.pileCount == null || data.data.pileCount == 0) {
                        new CountUp("redPercent", 0, 0, 1, 3, options).start();
                        new CountUp("greenPercent", 0, 0, 1, 3, options).start();
                        element.progress("redPercent", "0%");
                        element.progress("greenPercent", "0%");
                        element.progress("bluePercent", "0%");

                    } else {
                        new CountUp("redPercent", 0, ((data.data.directCount) / (data.data.pileCount)) * 100, 1, 3, options).start();
                        new CountUp("greenPercent", 0, ((data.data.alternatCount) / (data.data.pileCount)) * 100, 1, 3, options).start();
                        element.progress("redPercent", ((data.data.directCount) / (data.data.pileCount)) * 100 + "%");
                        element.progress("greenPercent", ((data.data.alternatCount) / (data.data.pileCount)) * 100 + "%");
                        element.progress("bluePercent", "100%");
                    }
                } else {
                    console.log(data.message)
                }

            }
        });
    }

    // window.onload=function (ev) {
    // }

    //桩群充电排榜数据
    // $.ajax({
    //     cache: false,
    //     type: "get",
    //     url: jsctx + "/console/selectStationChargeLeaderboard",
    //     processData: false,
    //     contentType: false,
    //     async: true,
    //     error: function (request) {
    //         console.log("Connection error");
    //     },
    //     success: function (data) {
    //         if (data.status == 200) {
    //             console.log(data)
    //             var str = ''
    //             for (var i = 0; i < data.data.length; i++) {
    //                 if (data.data.length > 0) {
    //                     var index = i + 1
    //                     str += "<li>" +
    //                         "<div class='powerList_left'>" +
    //                         '<span class="stationNumber stationNumber' + (index) + '">' + index + '</span>' +
    //                         '<span class="Level_stationName">' + data.data[i].stationName + '</span>' +
    //                         "</div>" +
    //                         "<div class='PowerList_right'>" +
    //                         "<span class='power' id='power2'>" + data.data[i].totalPower + "</span>" +
    //                         "<span class='power'>度</span>" +
    //                         "</div>" +
    //                         "</li>"
    //                     // $(".Level_stationName").eq(i).html(data.data[i].stationName)
    //                     // new CountUp(`power\${i+1}`, 0, data.data[i].totalPower, 0, 3, options).start();
    //                     // $(".power").find(i).html(data.data[i].totalPower+" 度")
    //                 }
    //             }
    //             $(".powerList ul").append(str)
    //         } else {
    //             parent.layer.msg(data.message);
    //
    //         }
    //
    //     }
    // });


    //返回电桩状态统计
    function selectCountByPileStatus(eleStationId) {
        $.ajax({
            // cache: false,
            type: "get",
            url: jsctx + "/console/selectCountByPileStatus",
            data: {
                "eleStationId": eleStationId
            },
            // processData: false,
            // contentType: false,
            async: true,
            error: function (request) {
                console.log("Connection error");
            },
            success: function (data) {
                if (data.status == 200) {
                    new CountUp("pileMalfunction", 0, data.data.pileMalfunction, 0, 3, options).start();
                    new CountUp("snatching", 0, data.data.snatching, 0, 3, options).start();
                    new CountUp("idle", 0, data.data.idle, 0, 3, options).start();
                    new CountUp("offline", 0, data.data.offline, 0, 3, options).start();
                    new CountUp("charging", 0, data.data.charging, 0, 3, options).start();
                } else {
                    parent.layer.msg(data.message);

                }

            }
        });
    }


</script>
<script>
    <%--    var map, geolocation;--%>
    <%--    //加载地图，调用浏览器定位服务--%>
    <%--    map = new AMap.Map('container', {--%>
    <%--        mapStyle: "amap://styles/1304bcaddf7703edd715133571354678",--%>
    <%--        resizeEnable: true,--%>
    <%--        zoom: 10,--%>
    <%--        // center: [121.59996, 31.197646],--%>
    <%--    });--%>
    <%--    map.plugin('AMap.Geolocation', function () {--%>
    <%--        geolocation = new AMap.Geolocation({--%>
    <%--            enableHighAccuracy: true,//是否使用高精度定位，默认:true--%>
    <%--            timeout: 10000,          //超过10秒后停止定位，默认：无穷大--%>
    <%--            buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)--%>
    <%--            zoomToAccuracy: false,      //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false--%>
    <%--            buttonPosition: 'LB',--%>
    <%--            noIpLocate: 1,--%>
    <%--            // panToLocation: true,--%>
    <%--        });--%>
    <%--        geolocation.getCurrentPosition();--%>
    <%--        AMap.event.addListener(geolocation, 'complete', onComplete);//返回定位信息--%>
    <%--        AMap.event.addListener(geolocation, 'error', onError);      //返回定位出错信息--%>
    <%--    });--%>

    <%--    //解析定位结果--%>
    <%--    function onComplete(data) {--%>
    <%--        var str = ['定位成功'];--%>
    <%--        str.push('经度：' + data.position.getLng());--%>
    <%--        str.push('纬度：' + data.position.getLat());--%>
    <%--        if (data.accuracy) {--%>
    <%--            str.push('精度：' + data.accuracy + ' 米');--%>
    <%--        }//如为IP精确定位结果则没有精度信息--%>
    <%--        str.push('是否经过偏移：' + (data.isConverted ? '是' : '否'));--%>
    <%--        document.getElementById('tip').innerHTML = str.join('<br>');--%>
    <%--    }--%>

    <%--    //解析定位错误信息--%>
    <%--    function onError(data) {--%>
    <%--        document.getElementById('tip').innerHTML = '定位失败';--%>
    <%--    }--%>

    <%--    function getPileAdress() {--%>
    <%--        $.ajax({--%>
    <%--            "type": "post",--%>
    <%--            "url": "${ctx}/console/selectStationAndLatiLong",--%>
    <%--            "data": {},--%>
    <%--            "success": function (data) {--%>
    <%--                // console.warn(data)--%>
    <%--                // data.data.length = 50--%>
    <%--                var markers = [];--%>
    <%--                for (var i = 0; i < data.data.length; i++) {--%>
    <%--                    var activeIcon = '<div class="marker-route marker-marker-bus-from blue button"></div>'--%>
    <%--                    markers.push({--%>
    <%--                        longitude: data.data[i].longitude,--%>
    <%--                        latitude: data.data[i].latitude,--%>
    <%--                        content: activeIcon,--%>
    <%--                        stationName: data.data[i].stationName,--%>
    <%--                        elecStationId: data.data[i].elecStationId--%>
    <%--                    })--%>
    <%--                    // console.warn(markers)--%>
    <%--                }--%>

    <%--                markers.forEach(function (marker) {--%>
    <%--                    console.warn(marker)--%>
    <%--                    var bgimg = marker.activeImg;--%>
    <%--                    var marker = new AMap.Marker({ //添加自定义点标记--%>
    <%--                        map: map,--%>
    <%--                        position: [marker.longitude, marker.latitude], //基点位置--%>
    <%--                        offset: new AMap.Pixel(-17, -42), //相对于基点的偏移位置--%>
    <%--                        draggable: false,  //是否可拖动--%>
    <%--//                content: '<div  class="'+bgimg+'"  href="'+marker.href+'"></div>'   //自定义点标记覆盖物内容--%>
    <%--                        content: marker.content,--%>
    <%--                        stationName: marker.stationName,--%>
    <%--                        elecStationId: marker.elecStationId--%>
    <%--                        // href:marker.href--%>
    <%--                    });--%>
    <%--                    // map.setFitView();--%>

    <%--                    marker.on("click", function (e) {--%>
    <%--                        console.log(e)--%>
    <%--                        var infoWindow = new AMap.InfoWindow({--%>
    <%--                            anchor: 'bottom-center',--%>
    <%--                            content: "<span style='padding:0 8px'>" + e.target.Ce.stationName + "</span>",--%>
    <%--                            offset: new AMap.Pixel(0, -25),--%>

    <%--                        });--%>
    <%--                        infoWindow.open(map, [e.lnglat.lng, e.lnglat.lat])--%>
    <%--                        selectCountByPileStatus(e.target.Ce.elecStationId)--%>
    <%--                    })--%>


    <%--                });--%>
    <%--                // alert(markers.length)--%>

    <%--            }--%>
    <%--        })--%>
    <%--    }--%>


    var todayTotalData = '';
    var monthTotalData = '';
    var yearTotalData = '';
    var totalData = ''
    $(".wrapper-content").on("click", ".dataByTime li", function () {
        var dateType = $(this).attr("dateType")
        var element = $(this)
        if (!$(this).hasClass("selected") && !$(this).hasClass("disabled")) {
            selectTenantOrderByDay(dateType, todayTotalData);
            element.addClass("selected").siblings("li").removeClass("selected");
            element.addClass("disabled")
        } else {
            if (dateType == "1") {
                totalData = JSON.parse(todayTotalData)
            } else if (dateType == "2") {
                totalData = JSON.parse(monthTotalData);
            } else if (dateType == "3") {
                totalData = JSON.parse(yearTotalData)
            }
            element.addClass("selected").siblings("li").removeClass("selected");
            new CountUp("orderCount", 0, totalData.orderCount, 0, 3, options).start();
            new CountUp("chargingTimeCount", 0, totalData.chargingTimeCount, 2, 3, options).start();
            new CountUp("chargeCount", 0, totalData.chargeCount, 2, 3, options).start();
            new CountUp("serviceMoneyCount", 0, totalData.serviceMoneyCount, 2, 3, options).start();
            new CountUp("totalMoney", 0, totalData.totalMoney, 2, 3, options).start();
        }
    })

    function selectTenantOrderByDay(dateType, todayData) {
        $.ajax({
            cache: false,
            type: "POST",
            url: jsctx + "/console/selectTenantOrderByDay",
            data: {
                "dateType": dateType,
                "todayData": todayData
            },
            // processData: false,
            // contentType: false,
            async: true,
            error: function (request) {
                console.log("Connection error");
            },
            success: function (data) {
                if (data.status == 200) {
                    if (dateType == "1") {
                        todayTotalData = JSON.stringify(data.data);
                    } else if (dateType == "2") {
                        monthTotalData = JSON.stringify(data.data);
                    } else {
                        yearTotalData = JSON.stringify(data.data);
                    }
                    new CountUp("orderCount", 0, data.data.orderCount, 0, 3, options).start();
                    new CountUp("chargingTimeCount", 0, data.data.chargingTimeCount, 2, 3, options).start();
                    new CountUp("chargeCount", 0, data.data.chargeCount, 2, 3, options).start();
                    new CountUp("serviceMoneyCount", 0, data.data.serviceMoneyCount, 2, 3, options).start();
                    new CountUp("totalMoney", 0, data.data.totalMoney, 2, 3, options).start();
                } else {
                    parent.layer.msg(data.message);

                }

            }, complete: function () {
                $(".loadingShade").fadeOut(500)
            }
        });
    }

    function countAllOrder() {
        $.ajax({
            cache: false,
            type: "POST",
            url: jsctx + "/console/countAllOrder",
            data: {
                "dataAuth": $("#dataAuth").val()
            },
            // processData: false,
            // contentType: false,
            async: true,
            error: function (request) {
                console.log("Connection error");
            },
            success: function (data) {
                if (data.status == 200) {
                    new CountUp("orderCount", 0, data.data.orderCount, 0, 3, options).start();
                    new CountUp("chargingTimeCount", 0, data.data.chargingTimeCount, 2, 3, options).start();
                    new CountUp("chargeCount", 0, data.data.chargeCount, 2, 3, options).start();
                    new CountUp("serviceMoneyCount", 0, data.data.serviceMoneyCount, 2, 3, options).start();
                    new CountUp("totalMoney", 0, data.data.totalMoney, 2, 3, options).start();
                } else {
                    parent.layer.msg(data.message);
                }

            }, complete: function () {
                $(".loadingShade").fadeOut(500)
            }
        });
    }

    function countTodayOrder() {
        $.ajax({
            cache: false,
            type: "POST",
            url: jsctx + "/console/countTodayOrder",
            // processData: false,
            // contentType: false,
            data: {
                "dataAuth": $("#dataAuth").val()
            },
            async: true,
            error: function (request) {
                console.log("Connection error");
            },
            success: function (data) {
                if (data.status == 200) {
                    new CountUp("todayOrder", 0, data.data.orderCount, 0, 3, options).start();
                    new CountUp("todayTime", 0, data.data.chargingTimeCount, 2, 3, options).start();
                    new CountUp("todayPower", 0, data.data.chargeCount, 2, 3, options).start();
                    new CountUp("todayMoney", 0, data.data.totalMoney, 2, 3, options).start();
                } else {
                    parent.layer.msg(data.message);

                }

            }, complete: function () {
                $(".loadingShade").fadeOut(500)
            }
        });
    }

    function countStation(bizType) {
        $.ajax({
            cache: false,
            type: "POST",
            url: jsctx + "/console/countStation",
            data: {
                "bizType": bizType,
                "dataAuth": $("#dataAuth").val()
            },
            // processData: false,
            // contentType: false,
            async: true,
            error: function (request) {
                console.log("Connection error");
            },
            success: function (data) {
                if (data.status == 200) {
                    new CountUp("stationCount", 0, data.data.stationCount, 0, 3, options).start();
                    new CountUp("pileCount", 0, data.data.pileCount, 0, 3, options).start();
                    new CountUp("gunCount", 0, data.data.gunCount, 0, 3, options).start();
                    new CountUp("directCount", 0, data.data.directCount, 0, 3, options).start();
                    new CountUp("alternatCount", 0, data.data.alternatCount, 0, 3, options).start();
                    // new CountUp("pileMalfunction", 0, data.data.pileMalfunction, 0, 3, options).start();
                    // new CountUp("snatching", 0, data.data.snatching, 0, 3, options).start();
                    // new CountUp("idle", 0, data.data.idle, 0, 3, options).start();
                    // new CountUp("offline", 0, data.data.offline, 0, 3, options).start();
                    // new CountUp("charging", 0, data.data.charging, 0, 3, options).start();
                    if (data.data.pileCount == null || data.data.pileCount == 0) {
                        new CountUp("redPercent", 0, 0, 1, 3, options).start();
                        new CountUp("greenPercent", 0, 0, 1, 3, options).start();
                        layui.use('element', function(){
                            var element = layui.element;
                            element.progress("redPercent", "0%");
                            element.progress("greenPercent", "0%");
                            element.progress("bluePercent", "0%");
                        });

                    } else {
                        new CountUp("redPercent", 0, ((data.data.directCount) / (data.data.pileCount)) * 100, 1, 3, options).start();
                        new CountUp("greenPercent", 0, ((data.data.alternatCount) / (data.data.pileCount)) * 100, 1, 3, options).start();
                        layui.use('element', function(){
                            var element = layui.element;
                            element.progress("redPercent", ((data.data.directCount) / (data.data.pileCount)) * 100 + "%");
                            element.progress("greenPercent", ((data.data.alternatCount) / (data.data.pileCount)) * 100 + "%");
                            element.progress("bluePercent", "100%");
                        });
                    }
                } else {
                    parent.layer.msg(data.message);

                }

            }, complete: function () {
                $(".loadingShade").fadeOut(500)
            }
        });
    }

    function countGun(bizType) {
        $.ajax({
            // cache: false,
            type: "get",
            url: jsctx + "/console/countGun",
            data: {
                "bizType": bizType,
                "dataAuth": $("#dataAuth").val()
            },
            // processData: false,
            // contentType: false,
            async: true,
            error: function (request) {
                console.log("Connection error");
            },
            success: function (data) {
                if (data.status == 200) {
                    new CountUp("pileMalfunction", 0, data.data.pileMalfunction, 0, 3, options).start();
                    new CountUp("snatching", 0, data.data.snatching, 0, 3, options).start();
                    new CountUp("idle", 0, data.data.idle, 0, 3, options).start();
                    new CountUp("offline", 0, data.data.offline, 0, 3, options).start();
                    new CountUp("charging", 0, data.data.charging, 0, 3, options).start();
                } else {
                    parent.layer.msg(data.message);

                }

            }
        });
    }

    function countStationOrderRank(dateType) {
        $("#rank").html('');
        $.ajax({
            // cache: false,
            type: "get",
            url: jsctx + "/console/countStationOrderRank",
            data: {
                "dateType": dateType,
                "dataAuth": $("#dataAuth").val()
            },
            // processData: false,
            // contentType: false,
            async: true,
            error: function (request) {
                console.log("Connection error");
            },
            success: function (data) {
                if (data.status == 200) {

                    var str = ''
                    for (var i = 0; i < data.data.length; i++) {
                        if (data.data.length > 0) {
                            var index = i + 1
                            str += "<li>" +
                                "<div class='powerList_left'>" +
                                '<span class="stationNumber stationNumber' + (index) + '">' + index + '</span>' +
                                '<span class="Level_stationName">' + data.data[i].stationName + '</span>' +
                                "</div>" +
                                "<div class='PowerList_right'>" +
                                "<span class='power' id='power2'>" + data.data[i].totalPower + "</span>" +
                                "<span class='power'>度</span>" +
                                "</div>" +
                                "</li>"
                        }
                    }
                    $(".powerList ul").append(str)
                } else {
                    parent.layer.msg(data.message);

                }

            }
        });
    }


    // selectStationAllData();
    countAllOrder();
    countTodayOrder();
    // getPileAdress();
    countStation("0");
    countGun("0");
    countStationOrderRank("0")

    // selectCountByPileStatus("")
</script>
</html>

<script src="${ctx}/libjs/plugins/newEdition/newEdition.js"></script>


